import Login from "../page/Login";
import User from "../page/User";
import APP from "../App";
import About from "../page/About";
import Board from "../page/Board";
import Layout from "../page/Layout";
import NotFound from "../page/NotFound";
import { createBrowserRouter } from "react-router-dom";

// 嵌套配置 使用<Outlet>配置出口
// const router = createBrowserRouter([
//   {
//     path: "/APP",
//     element: <APP />,
//     children: [
//       { path: "/login", element: <Login /> },
//       { path: "/user", element: <User /> },
//     ],
//   },
// ]);

const router = createBrowserRouter([
  { path: "/APP", element: <APP /> },
  { path: "/login", element: <Login /> },
  { path: "/user", element: <User /> },
  { path: "/user/:id/:name", element: <User /> },

  {
    path: "/",
    element: <Layout />,
    children: [
      {
        index: true, //默认二级路由
        element: <Board />,
      },

      { path: "about", element: <About /> },
    ],
  },
  {
    path: "*",
    element: <NotFound />,
  },
]);
export default router;
